package com.lry.web.message.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lry.web.message.entity.Message;
import com.lry.web.message.mapper.MessageMapper;
import com.lry.web.message.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.WeakHashMap;

@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    MessageMapper messageMapper;


    public List<Message> getMessagesYread() {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("read",1);
        return messageMapper.selectList(wrapper);
    }
    public List<Message> getMessagesNread() {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("read",0);
        return messageMapper.selectList(wrapper);
    }


    public int setMessage(Message message) {
        return messageMapper.insert(message);
    }
}
